#!/usr/bin/python
# -*- coding: UTF-8 -*-
from random import *

# 随机浮点数:  0.0 <= x < 1.0
print(random())

# 随机浮点数:  2.5 <= x < 10.0
print(uniform(2.5, 10.0))

# 0-9的整数
print(randrange(10))

# 0-100的偶数
print(randrange(0, 101, 2))

# 从序列随机选择一个元素
print(choice(['win', 'lose', 'draw']))

# 对序列进行洗牌，改变原序列
deck = 'ace two three four'.split()
shuffle(deck)
print(deck)

# 不改变原序列的抽取指定数目样本，并生成新序列
print(sample([10, 20, 30, 40, 50], k=4))

# 6次旋转红黑绿轮盘(带权重可重复的取样)，不破坏原序列
print(choices(['red', 'black', 'green'], [18, 18, 2], k=6))


